/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package testingexcel;

import java.util.ArrayList;

/**
 *
 * @author Joe
 */
public class ProjectGroup {
    public static final int MAX_GROUP_SIZE = 6;

    public ProjectGroup(int desiredSize)
    {
        names = new ArrayList<String>(MAX_GROUP_SIZE);
        count = 0;
        size = desiredSize;

    }

    public void add(ProjectPair p)
    {
        if (count + p.getNum() > MAX_GROUP_SIZE)
        {
            System.out.println("Too many students in the group!");
            return;
        }
        if(p.getNum() == 2)
        {
            names.add(p.getFirstName());
            names.add(p.getSecondName());
            count += 2;
            return;
        }
        if(p.getNum() == 1)
        {
            names.add(p.getFirstName());
            count++;
            return;
        }
        else
            System.out.println("something wrong with your pair");
    }

    public int getCount()
    {
        return count;
    }

    public boolean hasRoom(ProjectPair p)
    {
        return ((count + p.getNum()) <= size);
    }

    public boolean isFull()
    {
        return count >= size;
    }

    public ArrayList<String> getNames()
    {
        return names;
    }

    private ArrayList<String> names;
    private int count;
    private int size;
}
